//配置token验证规则

const expressJwt = require("express-jwt");
const { TOKEN_KEY } = require("../utils/const"); //常量的引入

const jwtAuth = expressJwt({
    secret: TOKEN_KEY, //生成token时使用的密钥
    algorithms: ['HS256'],
    credentialsRequired: false
}).unless({
    //不需要经过token验证
    path: ['/users/login', '/users/register','/admin/login','/admin/register']
    
});

module.exports = jwtAuth;